home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / network / scrub0.zip / SCRUB0.PAS < prev   
Pascal/Delphi Source File  |  1989-03-26  |  1KB  |  38 lines

  1. { Utility to scrub the extra nybble from the 36-bit SIMTEL20 word. }
  2.  
  3. program scrub_zeros;
  4.  
  5. var infile    : file;
  6.     outfile   : file;
  7.     buf       : array[1..9] of byte;
  8.     in_count  : word;
  9.     out_count : word;
  10.     p         : integer;
  11.  
  12. begin
  13. if (ParamStr(1)='') or (ParamStr(2)='')
  14.    then writeln('Command :     Scrub0 <input.fil> <output.fil>')
  15.    else
  16.        begin
  17.        assign(infile,ParamStr(1));
  18.        reset(infile,1);
  19.        assign(outfile,ParamStr(2));
  20.        rewrite(outfile,1);
  21.  
  22.        blockread(infile,buf,9,in_count);
  23.        while in_count=9 do
  24.           begin
  25.           for p:=5 to 8 do
  26.              begin
  27.              buf[p]:=    ((buf[p]   shl 4) and $F0)
  28.                       or ((buf[p+1] shr 4) and $0F);
  29.              end;
  30.              blockwrite(outfile,buf,8,out_count);
  31.              blockread(infile,buf,9,in_count);
  32.           end;
  33.        if in_count=5 then blockwrite(outfile,buf,4,out_count);
  34.  
  35.        close(infile);
  36.        close(outfile);
  37.        end;
  38. end.